package com.guigu.qingcheng.service;


import com.guigu.qingcheng.pojo.order.TbOrder;
import com.guigu.qingcheng.pojo.order.TbOrderItem;
import com.guigu.qingcheng.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Component
@FeignClient("service-order")
public interface CartFeign {

    @GetMapping("/order/cart/findCartList")
    public List<Map<String,Object>> findCartList(@RequestParam("username") String username);

    @GetMapping("/order/cart/addItem")
    public void addItem(@RequestParam("username") String username, @RequestParam("skuId") String skuId, @RequestParam("num") Integer num);

    @GetMapping("/order/cart/updateChecked")
    public void updateChecked(@RequestParam("username") String username,@RequestParam("skuId") String skuId, @RequestParam("checked") boolean checked);

    @GetMapping("/order/cart/deleteCheckedCart")
    public R deleteCheckedCart();

    @GetMapping("/order/cart/preferential")
    public Map preferential();

    @GetMapping("/order/cart/findNewOrderItemList")
    List<Map<String, Object>> findNewOrderItemList();


    @PostMapping("/order/tborder/saveOrder")
    public Map<String,Object> saveOrder(@RequestBody TbOrder order );

}
